-
-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update thirdparty tests, make subprocess testrunner run user code in root classloader #2561
Conversation
private def copy( | ||
framework: String = framework, | ||
classpath: Seq[String] = classpath, | ||
arguments: Seq[String] = arguments, | ||
sysProps: Map[String, String] = sysProps, | ||
outputPath: String = outputPath, | ||
colored: Boolean = colored, | ||
testCp: String = testCp, | ||
homeStr: String = homeStr, | ||
globSelectors: Seq[String] = globSelectors | ||
): TestArgs = new TestArgs( | ||
framework, | ||
classpath, | ||
arguments, | ||
sysProps, | ||
outputPath, | ||
colored, | ||
testCp, | ||
homeStr, | ||
globSelectors | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We made this one private and some other tricks to keep the option to evolve this class in a binary compatible way. What's the intention of changing that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still WIP, but I want to try to adjust the code path so we don't need to use a case class
here. That would make maintaining binary compatibility much simpler
Should be ready for review I think |
Move
thirdparty
fromintegration/
toexample/
, and simplify them down toacyclic
,fansi
, andjimfs
. We can add more complex builds later if we want, but for now just having some realistic builds that are not bitrotted and old is already an improvement over what we have now.Flip the sub-process
TestRunner
classloaders on its head: rather than runnerTestRunner.scala
in the boot classloader and user code in a sub-classloader, we run user code in the boot classloader andTestRunner.scala
in a sub classloader. This is necessary to make JimFS work, and would probably fix Tests fail due to class loading issue - GraalVM cannot be used. #716 and related issues.Broke up and cleaned up
TestRunner.scala
:TestRunner
andTestRunnerMain0
, the two entrypoints, fromTestRunnerUtils
TestModule
and read from the file byTestRunner
ClosableIterator
withgeny.Generator
, which also provides guaranteed closing after iterationMarked most of
testrunner
as@internal
. Most of these could beprivate[mill]
, but I think we don't have a clear idea of how this stuff is meant to be used yet, and it's plausible that other people may want to interact with the testrunner in their own custom test suites. I think@internal
is better suited for now until we either (a) know better what a stable API looks like or (b) decide that this stuff should not be used externally.We have much more control over
TestRunner.scala
than we do over user code, so we can make sure thatTestRunner.scala
works when running in a semi-isolated classloader, whereas for user code we can offer no such guarantees. We can't do anything for.testLocal
that runs in-process, but at least for.test
we can try to offer them a clean classloader environment.The classloader for user code is not 100% clean: we still have a single class
mill.testrunner.entrypoint.TestRunnerMain
added within it. That's probably OK, since no matter what we do w.r.t. shading and stuff we still need somewhere to put our own main method to bootstrap themill.testrunner
classloader.The testrunner changes are covered by existing unit and integration/example tests, and the new "user code runs in clean classloader" logic is covered by
example.thirdparty[jimfs].local
.